App.require(function () {
    App.defineWidgetBehavior("active", {
        render: function (ctx) {
            
        },
        initialize: function () {
            this.attachDiyEvent("click", this.clickHandler);
        },
        clickHandler: function (ev) {
            var scene = this.target.getScene(), target = this.target;
            if (typeof target.isPointIn === "function" 
                && target.isPointIn(scene.getContext(), ev.x, ev.y)) {
                scene.activeWidget = target;
                var canvas = target.getScene().canvas;
                var event = document.createEvent("CustomEvent");
                event.initCustomEvent("edit", true, true,  {
                    widget: target,
                    data: target.createEditForm()
                });
                canvas.dispatchEvent(event);
                return true;
            }
            return false;
        }
    });
})